#ifndef SINGLEINSTANCE_H
#define SINGLEINSTANCE_H
#include "audioplayer.h"
#include "systemHead.h"

class SingleInstance
{
private:
    SingleInstance()
    {

    }
    ~SingleInstance()
    {

    }
    SingleInstance(const SingleInstance &) = delete;
    SingleInstance &operator=(const SingleInstance &) = delete;
public:
    std::mutex                  CondProductMutex;
    std::condition_variable     CondProductPacket;

    std::mutex                  CondConsumeMutex;
    std::condition_variable     CondConsumePacket;

    AudioPlayer                 audioPlayer;
    int                         MediaPlayStatus;

    bool                        StartFlag = false;
    bool                        FirstLoadFile  = false;//是否经历过第一次拖入文件
    bool                        LoadFile = false;//是否已载入文件
    std::mutex                  PlayStatuesMutex;
    std::condition_variable     CondPlayStatues;

    bool                        End = false;

    double                      ProgressRotia = 0;//目前进度占总进度的比例,是ffmpegdecode用来控制进度条的。
public:
    void CheckPlayStatus();
    static SingleInstance &GetInstanca()
    {
        static SingleInstance instance;
        return  instance;
    }

};

#endif // SINGLEINSTANCE_H
